<!DOCTYPE html>
<html>

<head>
    <meta name="layout" content="main2"/>
    <g:set var="entityName" value="${message(code: 'workflowInstance.label', default: 'workflowInstance')}" />
    <title>反馈工作流实例</title>
</head>

<body>

<div class="main-body">
    <div class="page-wrapper">
        <!-- Page-header start -->
        <div class="page-header">
            <div class="page-header-title">
                <h4>新增反馈工作流实例</h4>
            </div>

            <div class="page-header-breadcrumb">
                <ul class="breadcrumb-title">
                    <li class="breadcrumb-item">
                        <a href="/salesDashboard/index">
                            <i class="icofont icofont-home"></i>
                        </a>
                    </li>
                    
                    <li class="breadcrumb-item"><a href="#!">新增反馈工作流实例</a>
                    </li>
                </ul>
            </div>
        </div>
        <!-- Page-header end -->
        <!-- Page-body start -->
        <div class="page-body">
        <g:if test="${flash.message}">
            <ul class="errors" role="alert">
                <g:eachError bean="${flash.message}" var="error">
                    <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>>
                        <g:message error="${error}"/>
                    </li>
                </g:eachError>
            </ul>
        </g:if>
        <g:hasErrors bean="${this.workflowInstance}">
            <ul class="errors" role="alert">
                <g:eachError bean="${this.workflowInstance}" var="error">
                    <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message error="${error}"/></li>
                </g:eachError>
            </ul>
        </g:hasErrors>
        <!-- Hover table card start -->
        <g:form action="saveWorkflowInstanceOnIssue" class="form-horizontal">
        <div class="card">
                <div class="card-header">
                    <h5>反馈信息</h5>

                    <div class="card-header-right">
                        <i class="icofont icofont-rounded-down"></i>
                    </div>
                </div>

                <div class="card-block">
                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">联系人</label>
                            <div class="col-md-3">
                                <g:select class="form-control" name="issue.contact.id" value="${this.workflowInstance?.issue?.contact?.id}" optionValue="contact" optionKey="contactId"
                                          from="${com.next.ContactTeam.findAllByUser(this?.user)}" noSelection="${['': '请选择']}"/>
                            </div>

                            <label class="col-md-2 col-form-label">客户</label>
                            <div class="col-md-3">
                                <g:select class="form-control" name="issue.account.id" value="${this.workflowInstance?.issue?.account?.id}" optionValue="account" optionKey="accountId"
                                          from="${com.next.AccountTeam.findAllByUser(this?.user)}" noSelection="${['': '请选择']}"/>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">资产</label>
                            <div class="col-md-3">
                                <g:select class="form-control" name="issue.asset.id" value="${this.workflowInstance?.issue?.asset?.id}" optionValue="asset" optionKey="assetId"
                                          from="${com.next.AssetTeam.findAllByUser(this?.user)}" noSelection="${['': '请选择']}"/>
                            </div>
                            <label class="col-md-2 col-form-label">项目</label>
                            <div class="col-md-3">
                                <g:select class="form-control" name="issue.project.id" value="${this.workflowInstance?.issue?.project?.id}" optionValue="project" optionKey="projectId"
                                          from="${com.next.ProjectTeam.findAllByUser(this?.user)}" noSelection="${['': '请选择']}"/>
                            </div>
                        </div>



                        <div class="form-group row">
                            <label class="col-md-2 col-form-label is-required">标题</label>

                            <div class="col-md-3">
                                <g:textField class="form-control" name="issue.subject" id="subject" value="${this.workflowInstance?.issue?.subject}" />
                            </div>
                        </div>



                        <div class="form-group row">
                            <label class="col-md-2 col-form-label is-required">状态</label>

                            <div class="col-md-3">
                                <g:select class="form-control" name="issue.status.id" optionKey="id" noSelection="${['': '请选择']}" optionValue="name" from="${com.next.IssueStatus.list()}" value="${this.workflowInstance?.issue?.status?.id}" />
                            </div>
                            <label class="col-md-2 col-form-label is-required">来源</label>

                            <div class="col-md-3">
                                <g:select class="form-control" name="issue.origin.id" optionKey="id" noSelection="${['': '请选择']}" optionValue="name" from="${com.next.IssueOrigin.list()}" value="${this.workflowInstance?.issue?.origin?.id}" />
                            </div>

                        </div>



                        <div class="form-group row">
                            <label class="col-md-2 col-form-label is-required">优先级</label>

                            <div class="col-md-3">
                                <g:select class="form-control" name="issue.priority.id" optionKey="id" noSelection="${['': '请选择']}" optionValue="name" from="${com.next.IssuePriority.list()}" value="${this.workflowInstance?.issue?.priority?.id}" />
                            </div>
                            <label class="col-md-2 col-form-label is-required">类型</label>

                            <div class="col-md-3">
                                <g:select class="form-control" name="issue.type.id" optionKey="id" noSelection="${['': '请选择']}" optionValue="name" from="${com.next.IssueType.list()}" value="${this.workflowInstance?.issue?.type?.id}" />
                            </div>

                        </div>



                        <div class="form-group row">
                            <label class="col-md-2 col-form-label is-required">原因</label>

                            <div class="col-md-3">
                                <g:select class="form-control" name="issue.reason.id" optionKey="id" noSelection="${['': '请选择']}" optionValue="name" from="${com.next.IssueReason.list()}" value="${this.workflowInstance?.issue?.reason?.id}" />
                            </div>

                        </div>



                        <div class="form-group row">

                            <label class="col-md-2 col-form-label is-required is-required">详细说明</label>

                            <div class="col-md-8">
                                <g:textArea rows="3" class="form-control" name="issue.description" id="description" value="${this.workflowInstance?.issue?.description}" />
                            </div>
                        </div>
                </div>
            </div>
            <div class="card">
                <div class="card-header">
                    <h5>工作流实例</h5>

                    <div class="card-header-right">

                        <i class="icofont icofont-rounded-down"></i>
                    </div>
                </div>

                <div class="card-block">
                    

                        <div class="form-group row">
                            <label class="col-md-2 control-label is-required">工作流</label>

                            <div class="col-md-3">
                                <g:textField class="hidden" name="project.id"
                                             value="${this.workflowInstance?.project?.id}"/>
                                <g:select  class="form-control" name="workflow.id" id="workflow"
                                           value="${this.workflowInstance?.workflow?.id}" from="${com.next.Workflow.findAllByActive(true)}"
                                           optionKey="id" optionValue="name" noSelection="${['': '请选择']}"></g:select>
                            </div>
                            <label class="col-md-2 control-label is-required">名称</label>

                            <div class="col-md-3">

                                <g:textField class="form-control" name="name" value="${this.workflowInstance?.name}"/>

                            </div>
                        </div>
                            
                        <div class="form-group row">
                            <div class="col-md-12">
                                <g:submitButton class="btn btn-info" name="update" value="保存"/>
                            </div>
                        </div>
                    
                </div>
                <!-- Hover table card end -->
            </div>
</g:form>
            <!-- Page-body end -->
        </div>
    </div>
</div>

</body>

</html>
